package sb.mybatisp;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sb.mybatisp.mapper.UserMapper;
import sb.mybatisp.pojo.User;

import java.util.Date;
import java.util.List;

@SpringBootApplication
@MapperScan("sb.mybatisp")
@RestController
public class MybatispApplication {

    public static void main(String[] args) {
        SpringApplication.run(MybatispApplication.class, args);
    }

    @RequestMapping("time")
    public String time() {
        return new Date().toLocaleString();
    }

    @Autowired
    private UserMapper userMapper;

    @RequestMapping("allUser")
    public List<User> allUser() {
        return userMapper.allUser();
    }
}
